package com.probiz.estore.common.model.order;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import com.probiz.estore.Constants;
import com.probiz.estore.common.model.order.base.OrderPickTbl;

/**
 * Model class for OrderPick. Add not database mapped fileds in this class.
 */
public class OrderPick extends OrderPickTbl {
	
	public static enum FilterHqlName{DEFAULT};
	//用于显示添加到备货单成功的订单
	private List<String> successOrderList = new ArrayList<String>();
	private List<String> failOrderList = new ArrayList<String>();
  	/**
	 * Default Empty Constructor for class OrderPick
	 */
	public OrderPick () {
		super();
	}
	/**
	 * 定义实体的业务名取值； orderPickName
	 * 必须手工完成这个部分，否则编译不通过。
	 */
	public String getOrderPickName () {
		if (this.orderPickId == null)
	        return "";
	    else
			//返回一个指定有业务意义的属性值;
			//如：product的VO就用product.productName
	        return this.orderPickId.toString();
	}
	/**
	 * Default Key Fields Constructor for class OrderPick
	 */
	public OrderPick (
		 Integer in_orderPickId
		) {
		super (
		  in_orderPickId
		);
	}
	public List<String> getSuccessOrderList() {
		return successOrderList;
	}
	public void setSuccessOrderList(List<String> successOrderList) {
		this.successOrderList = successOrderList;
	}
	public List<String> getFailOrderList() {
		return failOrderList;
	}
	public void setFailOrderList(List<String> failOrderList) {
		this.failOrderList = failOrderList;
	}

	@Override
	public int hashCode() {
		return super.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		return super.equals(obj);
	}
	
	/**
	 * 获得礼品类的备货明细项
	 * @return
	 */
	public List<OrderPickItem> getOrderPickList4Gift(){
		List<OrderPickItem> orderPickItemList = new ArrayList<OrderPickItem>();
		for(OrderPickItem orderPickItem: (Set<OrderPickItem>)orderPickItems){
			if(Constants.ITEM_TYPE_GIFT.equals(orderPickItem.getItemType())){
				orderPickItemList.add(orderPickItem);
			}
		}
		return orderPickItemList;
	}
	
}
